package densetsu.model.players;

import densetsu.model.Direction;
import densetsu.model.map.GameMap;

/**
 * Will represent a playable character. Implements Player interface.
 * 
 * @author Koen
 * 
 */
public class HumanPlayer implements Player {

	private int xCoordinate, yCoordinate;

	public HumanPlayer ( int x, int y ) {
		this.xCoordinate = x;
		this.yCoordinate = y;
	}

	/**
	 * Has no collision detection or anything yet! Apart from screen boundaries.
	 */
	@Override
	public void move ( Direction d ) {
		// TODO: One of the first things to implement, but first think of map
		// representation.
		if ( d == Direction.Left ) {
			xCoordinate = ( xCoordinate > 0 ? xCoordinate - 1 : 0 );
		} else if ( d == Direction.Right ) {
			xCoordinate = ( xCoordinate < GameMap.SIZE - 1 ? xCoordinate + 1 : GameMap.SIZE - 1 );
		} else if ( d == Direction.Up ) {
			yCoordinate = ( yCoordinate > 0 ? yCoordinate - 1 : 0 );
		} else if ( d == Direction.Down ) {
			yCoordinate = ( yCoordinate < GameMap.SIZE - 1 ? yCoordinate + 1 : GameMap.SIZE - 1 );
		}
	}

	@Override
	public void shoot ( ) {
		// TODO: This is for later, but needs implementing of course.
	}

	@Override
	public void jump ( ) {
		// TODO: This is also for later.
	}

	@Override
	public int getX ( ) {
		return this.xCoordinate;
	}

	@Override
	public int getY ( ) {
		return this.yCoordinate;
	}

	@Override
	public void setLocation ( int x, int y ) {
		this.xCoordinate = x;
		this.yCoordinate = y;
	}

}
